package defpackage; import android.app.Activity; import android.util.SparseArray; import android.view.View; import android.view.ViewTreeObserver; import android.widget.ImageView; import cn.wps.moffice.OfficeApp; import cn.wps.moffice_eng.R; import defpackage.eae; import defpackage.hue; import defpackage.huo; import java.util.HashMap; import java.util.Map; /* renamed from: fkb reason: default package */ public final class fkb extends fkc implements View.OnClickListener, hue.a { private int fPF = 0; /* renamed from: fkb$a */ class a extends fcv<Void, Void, Integer> { private a() { } /* synthetic */ a(fkb fkb, byte b) { this(); } private static Integer axO() { String bE = ebo.bE(OfficeApp.arx()); hwe hwe = new hwe(); hwe.dk("account", bE); hwe.dk("version", "2"); hwi.AW(2).a(hwe); try { return Integer.valueOf(Integer.parseInt(lwd.f("https://movip.wps.com/template/v2/user/credits" + "?" + lwd.r(hwe.cmr()), null))); } catch (Exception e) { e.printStackTrace(); return -1; } } /* Return type fixed from 'java.lang.Object' to match base method */ /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object[]] */ /* access modifiers changed from: protected */ @Override // defpackage.fcv public final /* synthetic */ Integer doInBackground(Void[] voidArr) { return axO(); } /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */ /* access modifiers changed from: protected */ @Override // defpackage.fcv public final /* synthetic */ void onPostExecute(Integer num) { Integer num2 = num; if (ebo.arU()) { fkb.this.e((fkb) num2); } } /* access modifiers changed from: protected */ @Override // defpackage.fcv public final void onPreExecute() { fkb.this.fPK.fQg.setVisibility(0); } } public fkb(Activity activity) { super(activity); } private void L(int i, boolean z) { if (i == -1) { return; } if (z) { this.fPF |= i; } else { this.fPF &= i ^ -1; } } private static void a(ImageView imageView, boolean z, int i) { if (z) { imageView.setVisibility(0); imageView.setImageResource(i); return; } imageView.setVisibility(8); } /* access modifiers changed from: private */ /* access modifiers changed from: public */ private void bxP() { L(256, eae.aRb() || eae.b.evR == eae.aQW().aQZ()); } private void e(fno fno) { boolean z = false; boolean vM = vM(256); a(this.fPK.fQf, vM, R.drawable.home_aboard_premium); a(this.fPK.fQc, vM || vM(2), R.drawable.home_aboard_privilege_pdf); ImageView imageView = this.fPK.fQd; if (vM || vM(4)) { z = true; } a(imageView, z, R.drawable.home_aboard_privilege_ad); if (fno != null) { f(fno); } } /* access modifiers changed from: private */ /* access modifiers changed from: public */ private void e(Integer num) { if (this.fPK != null && this.fPK.fQh != null) { if (num != null && num.intValue() >= 0) { this.fPK.fQh.setText(new StringBuilder().append(num).toString()); } else if (num == null || num.intValue() >= 0) { this.fPK.fQh.setText("0"); } else { this.fPK.fQh.setText(""); } } } /* access modifiers changed from: private */ /* access modifiers changed from: public */ private boolean vM(int i) { return (this.fPF & i) == i; } @Override // defpackage.fkc public final void bwy() { int i = this.fPF; this.fPF = 0; e((Integer) -1); e((fno) null); } @Override // defpackage.fkc public final void bxQ() { final fno bBh = fok.bBq().geJ.bBh(); if (bBh != null) { this.fPK.fPQ.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { /* class defpackage.fkb.AnonymousClass3 */ public final void onGlobalLayout() { fkb.this.fPK.fPQ.getViewTreeObserver().removeGlobalOnLayoutListener(this); fkb.this.f(bBh); } }); } } @Override // defpackage.fkc public final void c(fno fno) { f(fno); if (!(this.fPK.fQg == null || this.fPK.fQh == null)) { new a(this, (byte) 0).execute(new Void[0]); } if (this.fPK.fQs != null) { int aQZ = eae.aQW().aQZ(); if (eae.aRb() || eae.b.evR == aQZ) { this.fPK.fQs.setVisibility(8); } else if (eae.aQW().aQZ() != eae.b.evP) { this.fPK.fQs.setVisibility(0); this.fPK.fQs.setOnClickListener(this); } } } /* access modifiers changed from: protected */ @Override // defpackage.fkc public final void d(fno fno) { this.fPK.fPS.setVisibility(0); this.fPK.fPS.setOnClickListener(this); this.fPK.fPZ.setVisibility(8); e(fno); } /* JADX INFO: Can't fix incorrect switch cases order, some code will duplicate */ @Override // defpackage.hue.a public final void e(Map<String, huo.a> map) { boolean z; int i; bxP(); for (Map.Entry<String, huo.a> entry : map.entrySet()) { boolean b = hue.b(entry.getValue()); String key = entry.getKey(); switch (key.hashCode()) { case -785672382: if (key.equals("ads_free_i18n")) { z = false; break; } z = true; break; case -325192719: if (key.equals("pdf_toolkit")) { z = true; break; } z = true; break; default: z = true; break; } switch (z) { case false: i = 4; break; case true: i = 2; break; default: i = -1; break; } L(i, b); } d(fok.bBq().geJ.bBh()); } /* access modifiers changed from: protected */ @Override // defpackage.fkc public final void f(final fno fno) { this.fPK.fPQ.post(new Runnable() { /* class defpackage.fkb.AnonymousClass2 */ public final void run() { int measuredWidth = fkb.this.fPK.fPQ.getMeasuredWidth(); int dip2px = luf.dip2px(fkb.this.mActivity, 18.0f); boolean vM = fkb.this.vM(256); if (vM) { measuredWidth -= luf.dip2px(fkb.this.mActivity, 33.0f); } if (vM || fkb.this.vM(4)) { measuredWidth -= dip2px; } if (vM || fkb.this.vM(2)) { measuredWidth -= dip2px; } fkb.this.fPK.name.setMaxWidth(measuredWidth); fkb.this.fPK.name.setText(fno.userName); } }); } @Override // defpackage.fkc public final void loadData() { if (!this.fPL) { fno bBh = fok.bBq().geJ.bBh(); fcx.p(new Runnable(this) { /* class defpackage.hue.AnonymousClass2 */ final /* synthetic */ a iOE; { this.iOE = r1; } public final void run() { SparseArray<String> clg = hue.clg(); final HashMap hashMap = new HashMap(); for (int i = 0; i < clg.size(); i++) { String str = clg.get(clg.keyAt(i)); huo.a BE = huo.BE(str); if (BE != null) { hashMap.put(str, BE); } } if (this.iOE != null) { fzc.bJM().y(new Runnable() { /* class defpackage.hue.AnonymousClass2.AnonymousClass1 */ public final void run() { AnonymousClass2.this.iOE.e(hashMap); } }); } } }); if (bBh != null) { g(bBh); } fok.bBq().d(new foi<fno>() { /* class defpackage.fkb.AnonymousClass1 */ /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */ @Override // defpackage.foi, defpackage.foh public final /* synthetic */ void s(fno fno) { final fno fno2 = fno; if (fno2 != null) { fkb.this.mActivity.runOnUiThread(new Runnable() { /* class defpackage.fkb.AnonymousClass1.AnonymousClass1 */ public final void run() { fkb.this.bxP(); fkb.this.d(fno2); fkb.this.g(fno2); fkb.this.fPL = true; Runnable runnable = fkb.this.fPM; if (runnable != null) { runnable.run(); } } }); } } }); hue.a(this); } } public final void onClick(View view) { switch (view.getId()) { case R.id.home_my_user_go_member_layout /*{ENCODED_INT: 2131364244}*/: dwp.lV("public_center_premium_button_click"); if (eae.aQW().aQZ() != eae.b.evP) { fvf.aM(this.mActivity, "vip_home_premium"); return; } return; case R.id.home_my_userinfo_type_layout /*{ENCODED_INT: 2131364267}*/: if (eae.aQW().aQZ() != eae.b.evP) { dwp.km("public_center_premium_icon_click"); fvf.aM(this.mActivity, "vip_icon"); return; } return; default: return; } } }